import Vue from 'vue';
import Vuex from 'vuex';

import dashboard from './dashboard/index';
import excessTime from './dashboard/excessTime'
import MysqlTableSpace from './Mysql/TableSpace'
import MysqlIoInfo from './Mysql/IOInfo'
import MysqlThreadInfo from './Mysql/ThreadInfo'
import MysqlHit from './Mysql/Hit'
import SqlServerTableSpace from './SqlServer/TableSpace'
import SqlServerIoInfo from './SqlServer/IOInfo'
import SqlServerLogInfo from './SqlServer/LogInfo'
import ManagementOs from './ManageMent/OS'
import ManagementPort from './ManageMent/Port'
import ManagementPortStatus from './ManageMent/PortStatus'
import WarningPanel from './Warning/TableData'
import ThisDayExamineDB from './Examine/DBTotal'
import ThisDayExamineSE from './Examine/SETotal'

import ThisDayExamine from './Examine/Total'
import ItemMonitorServer from "./itemMonitor/server"
import ItemMonitorOracle from "./itemMonitor/oracle"
import ItemMonitorMysql from "./itemMonitor/mysql"
import ItemMonitorSqlServer from "./itemMonitor/sqlserver"
import ItemMonitorALL from "./itemMonitor/ItemMonitorALL"
import historyDataServerUsage from "./historyData/serverUsage"


Vue.use(Vuex);

const store = new Vuex.Store({
    state: {
        collapse: false,
        alertNum: {
            LEVEL_1: 0,
            LEVEL_2: 0,
            LEVEL_3: 0
        },
        user:{
            type:'',
        },
        isLogin:'',
        pageRefresh:'30',
        fullscreen:false,
        token:'',
    },
    getters: {
        getCollapse(state) {
            return state.collapse;
        },
        getAlertNum(state) {
            return state.alertNum;
        },
        getIsLogin(state) {
            return state.isLogin;
        },
        getPageRefresh(state){
           
        
          
           
            return state.pageRefresh
        },
        getFullscreenState(state){
            return state.fullscreen
        }

    },
    mutations: {
        triggerCollapse(state) {
            state.collapse = !state.collapse;
        },
        updateAlertNum(state, payload) {
            state.alertNum = payload.alertNum;
        },
     
        setUserType(state,type){
            state.user.type=type
          
        },
        setLoginStatus(state,type){
            state.isLogin=type
           
        },
        setPageRefresh(state,type){
            
            state.pageRefresh=type
            
           
        },
        updateFullscreenState(state) {
            state.fullscreen = !state.fullscreen;
        },
    },
    actions: {},
    modules: {
        dashboard,
        time:excessTime,
        MysqlTableSpace,
        MysqlIoInfo,
        MysqlThreadInfo,
        MysqlHit,
        SqlServerTableSpace,
        SqlServerIoInfo,
        SqlServerLogInfo,
        ManagementOs,
        WarningPanel,
        ThisDayExamineDB,
        ThisDayExamineSE,
        ThisDayExamine,
        ItemMonitorServer,
        ItemMonitorOracle,
        ItemMonitorMysql,
        ItemMonitorSqlServer,
        ItemMonitorALL,
        historyDataServerUsage,
        ManagementPort,
        ManagementPortStatus,
    }
});

export default store;